const domain1 = "https://api.it120.cc/small4";
const domain2 = "http://pay.aoaoxiong.top/";
function http({domain=1,url,data,method,header}){           //封装http函数
  //导航栏显示 loading
  wx.showNavigationBarLoading()
  return new Promise((resolve,reject) =>{
      wx.request({
          url:(domain ==1 ? domain1 :domain2) + url,
          data,
          method,
          header,
          success:(res) =>{
            wx.hideNavigationBarLoading()   //隐藏栏显示 loading
              resolve(res);
          },
          fail:(err) =>{
              reject(err)
          }
      })
  })
}
export {http,domain1};